﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Pong_Project
{
    class LevelManager
    {
        private static List<Level> levelSet;
        private static Level activeLevel;

        public LevelManager()
        {
            levelSet = FileReader.loadLevelSet();
            if (levelSet.Count == 0)
            {
                levelSet.Add(new Level());
            }
            SetActiveLevel(0);
        }

        public static int NumberOfLevels
        {
            get { return levelSet.Count; }
        }

        public static void SetActiveLevel(int levelNumber)
        {
            if (levelNumber > levelSet.Count)
            {
                throw new ArgumentException("Levelnumber is too high: " + levelNumber);
            }
            activeLevel = levelSet[levelNumber];
            CollisionDetector.ReplaceAllObstacles(activeLevel.Obstacles);
            GameObjectManager.ReplaceAllObstacles(activeLevel.Obstacles);
        }

        public void Update(GameTime gameTime)
        {
        }
    }
}
